//
//  NEDCountDownTool.h
//  MoreCoin
//
//  Created by 林宁宁 on 2020/3/17.
//  Copyright © 2020 MoreCoin. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NEDCountDownTool : NSObject

/// 倒计时 step = 1
/// @param target 关联的对象 该对象释放也跟着释放  不能为空
/// @param duration 时长 秒
/// @param progressBlock 开始倒计时回调
/// @param finishBlock 完成
+ (void)ned_addCountdownTarget:(id _Nonnull)target
                     duration:(CGFloat)duration
                     progress:(void(^_Nullable)(CGFloat total, CGFloat remain, id target))progressBlock
                       finish:(void(^ _Nullable)(id target))finishBlock;

+ (void)ned_addCountdownTarget:(id _Nonnull)target
                     duration:(CGFloat)duration
                         step:(CGFloat)step
                     progress:(void(^_Nullable)(CGFloat total, CGFloat remain, id target))progressBlock
                       finish:(void(^ _Nullable)(id target))finishBlock;

+ (void)ned_addCountdownTarget:(id _Nonnull)target
                      identify:(NSString * _Nullable)identify
                     duration:(CGFloat)duration
                         step:(CGFloat)step
                     progress:(void(^_Nullable)(CGFloat total, CGFloat remain, id target))progressBlock
                       finish:(void(^ _Nullable)(id target))finishBlock;

/// 延迟执行
+ (void)ned_addDelayTarget:(id _Nonnull)target
                  duration:(CGFloat)duration
                    finish:(void(^ _Nullable)(id target))finishBlock;
+ (void)ned_addDelayTarget:(id _Nonnull)target
                  identify:(NSString * _Nullable)identify
                  duration:(CGFloat)duration
                    finish:(void(^ _Nullable)(id target))finishBlock;

/// 重复执行
/// @param repeatCount 重复次数 -1就是无限循环
/// @param step 时间间隔 最小0.01
/// @param progressBlock 重复一次回调
+ (void)ned_addRepeatTarget:(id _Nonnull)target
               repeatCount:(CGFloat)repeatCount
                      step:(CGFloat)step
                  progress:(void(^_Nullable)(CGFloat repeatTimes, id target))progressBlock;
+ (void)ned_addRepeatTarget:(id _Nonnull)target
                   identify:(NSString * _Nullable)identify
               repeatCount:(CGFloat)repeatCount
                      step:(CGFloat)step
                  progress:(void(^_Nullable)(CGFloat repeatTimes, id target))progressBlock;


+ (void)ned_cleanCountdownTarget:(id)target;
+ (void)ned_cleanCountdownIdentify:(NSString *)identify;


@end

NS_ASSUME_NONNULL_END
